package com.ccjq.jq173.shosestore.core.db.manager;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class DbConfigReader
{
    private Properties properties;
    public DbConfigReader()
    {
        this.read();
    }
    /*
        读取配置文件
     */
    public void read()
    {
        properties=new Properties();
        InputStream is=DbConfigReader.class.getResourceAsStream("/dbConfig.properties");
        try
        {
            properties.load(is);
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }

    /*
        根据键获得值
         */
    public String getValue(String key){
        return properties.getProperty(key);
    }

    public static void main(String args[])
    {
        DbConfigReader dbConfigReader=new DbConfigReader();
        System.out.println(dbConfigReader.getValue("db.driver"));
    }
}
